package group.sicher.common.entity;

import javax.persistence.*;
import java.util.Objects;

/**
 * @Auth rock
 * @Date 2019/7/1 21:08
 * @description
 */
@Entity
@Table(name = "wm_shop_log")
public class ShopLogEntity {

    private Long id;
    private Integer serverId;
    private Long shopId;
    private String userName;
    private String controller;
    private String action;
    private String detail;
    private String ip;
    private String result;
    private Integer status;//TODO 状态枚举
    private Long addTime;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "server_id", nullable = true)
    public Integer getServerId() {
        return serverId;
    }

    public void setServerId(Integer serverId) {
        this.serverId = serverId;
    }

    @Basic
    @Column(name = "shop_id", nullable = true)
    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    @Basic
    @Column(name = "user_name", nullable = true, length = 50)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "controller", nullable = true, length = 50)
    public String getController() {
        return controller;
    }

    public void setController(String controller) {
        this.controller = controller;
    }

    @Basic
    @Column(name = "action", nullable = true, length = 50)
    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    @Basic
    @Column(name = "detail", nullable = true, length = 500)
    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    @Basic
    @Column(name = "ip", nullable = true, length = 50)
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Basic
    @Column(name = "result", nullable = true, length = 500)
    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    @Basic
    @Column(name = "status", nullable = true)
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "add_time", nullable = true)
    public Long getAddTime() {
        return addTime;
    }

    public void setAddTime(Long addTime) {
        this.addTime = addTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ShopLogEntity that = (ShopLogEntity) o;
        return id == that.id &&
                Objects.equals(serverId, that.serverId) &&
                Objects.equals(shopId, that.shopId) &&
                Objects.equals(userName, that.userName) &&
                Objects.equals(controller, that.controller) &&
                Objects.equals(action, that.action) &&
                Objects.equals(detail, that.detail) &&
                Objects.equals(ip, that.ip) &&
                Objects.equals(result, that.result) &&
                Objects.equals(status, that.status) &&
                Objects.equals(addTime, that.addTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, serverId, shopId, userName, controller, action, detail, ip, result, status, addTime);
    }
}
